package com.etc.service.impl;

import java.util.List;

import com.etc.dao.impl.AnnouncementDaoImpl;
import com.etc.entity.Announcement;
import com.etc.service.AnnouncementService;

public class AnnouncementServiceImpl implements AnnouncementService{
	AnnouncementDaoImpl dao = new AnnouncementDaoImpl();

	@Override
	public List<Announcement> queryAllAnnouncement() {
		
		//调用dao层
		List<Announcement> list = dao.queryAllAnnouncement();
		return list;
	}

	@Override
	public boolean addAnnouncement(Announcement announcement) {
		if (announcement!=null) {
			//不为空才可以添加
			//内容不可重复
			Announcement announcement2 = dao.queryAnnouncement(announcement.getA_content());
			if (announcement2==null) {
				boolean b = dao.addAnnouncement(announcement);
				return b;
			}
		}
		return false;
	}

	@Override
	public boolean rmvAnnouncement(int id) {
		boolean b = dao.rmvAnnouncement(id);
		return b;
	}

}
